﻿using UnityEngine;

namespace Share
{
    public class SingletonMonoObject<T> : EventReciever where T : MonoBehaviour
    {
        private static T _instance;

        public virtual void DoInit() { }

        public static T Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = InstanceHelper.Singleton<T>();
                    (_instance as SingletonMonoObject<T>).DoInit();
                }
                return _instance;
            }
        }
    }
}